package no.ntnu.item.ttm4115.termproject.playeragent.gui;

import java.awt.Dimension;

import no.ntnu.item.ttm4115.termproject.Login;
import no.tellu.common.actorframe.ActorSM;


/**
 *
 * @author  Kim A Martinsen
 */
@SuppressWarnings("serial")
public class OptionsDialog extends javax.swing.JFrame {

	
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    private javax.swing.JCheckBox jCheckBox4;
    private javax.swing.JCheckBox jCheckBox5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabelUpdate;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    @SuppressWarnings("unused")
	private MeetingPlaceGUI mainFrame;
    // End of variables declaration

    public OptionsDialog(MeetingPlaceGUI mainFrame) {
    	this.mainFrame = mainFrame;
    	
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private void initComponents() {

    	jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox3 = new javax.swing.JCheckBox();
        jCheckBox4 = new javax.swing.JCheckBox();
        jLabelUpdate = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Options");

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("001_05.png"))); // NOI18N
        jButton1.setText("Close");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("My Activity List"));

        jCheckBox1.setText("Show IM updates");
        if(mainFrame.getShowIM()){
        	jCheckBox1.setSelected(true);
        }
        else{
        	jCheckBox1.setSelected(false);
        }
        jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox1ActionPerformed(evt);
            }
        });
        if(mainFrame.getShowChat()){
        	jCheckBox2.setSelected(true);
        }
        else{
        	jCheckBox2.setSelected(false);
        }
        jCheckBox2.setText("Show group chat updates");
        jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox2ActionPerformed(evt);
            }
        });
        if(mainFrame.getShowDiscussion()){
        	jCheckBox3.setSelected(true);
        }
        else{
        	jCheckBox3.setSelected(false);
        }
        jCheckBox3.setText("Show group discussion updates");
        jCheckBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox3ActionPerformed(evt);
            }
        });
        
        if(mainFrame.getShowStatus()){
        	jCheckBox4.setSelected(true);
        }
        else{
        	jCheckBox4.setSelected(false);
        }
        
        jCheckBox4.setText("Show status updates");
        jCheckBox4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox1)
                    .addComponent(jCheckBox2)
                    .addComponent(jCheckBox3)
                    .addComponent(jCheckBox4))
                .addContainerGap(216, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jCheckBox1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBox2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBox3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBox4))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(312, 312, 312)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabelUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(27, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabelUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }

    private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
    	if(jCheckBox1.isSelected()){
			mainFrame.setShowIM(true);
			jLabelUpdate.setText("Enabled IM messages i activity update");
		}
		else{
			mainFrame.setShowIM(false);
			jLabelUpdate.setText("Disabled IM messages i activity update");
		}
    	}

    	@SuppressWarnings("unused")
		private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {
    		if(jCheckBox2.isSelected()){
    			mainFrame.setShowChat(true);
    			jLabelUpdate.setText("Enabled chat messages i activity update");
    		}
    		else{
    			mainFrame.setShowChat(false);
    			jLabelUpdate.setText("Disabled chat messages i activity update");
    		}
    	}

    	@SuppressWarnings("unused")
		private void jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) {
    		if(jCheckBox3.isSelected()){
    			mainFrame.setShowDiscussion(true);
    			jLabelUpdate.setText("Enabled discussion messages i activity update");
    		}
    		else{
    			mainFrame.setShowDiscussion(false);
    			jLabelUpdate.setText("Disabled discussion messages i activity update");
    		}
    	}
    	
    	private void jCheckBox4ActionPerformed(java.awt.event.ActionEvent evt) {
    		if(jCheckBox4.isSelected()){
    			mainFrame.setShowStatus(true);
    			jLabelUpdate.setText("Enabled status updates i activity update");

    		}
    		else{
    			mainFrame.setShowStatus(false);
    			jLabelUpdate.setText("Disabled status updates i activity update");

    		}
    		}
    	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    			this.dispose();
    		}

  
    	
    	
}

